import type {
  RoleMenuAddDTOType,
  RoleMenuUpdateDTOType,
  RoleMenuSearchDTOType,
} from '@/resources/interface/roleMenu/RoleMenuTypes'
import type { TableColumn } from '@/components/CommonTable.vue'
import { ComponentEnum, type FormItemConfig } from '@/components/CommonDialogForm.vue'

/**
 * 角色菜单表 参数对象
 */
export class RoleMenuParams {
  /**
   * 表单参数
   */
  static formColumn: FormItemConfig[] = [
    {
      label: '菜单id',
      prop: 'menuId',
      type: ComponentEnum.INPUT,
      field: 'menuId',
    },
    {
      label: '角色id',
      prop: 'roleId',
      type: ComponentEnum.INPUT,
      field: 'roleId',
    },
  ]
  /**
   * 表格参数
   */
  static tableColumn: TableColumn[] = [
    {
      label: '菜单id',
      field: 'menuId',
    },
    {
      label: '角色id',
      field: 'roleId',
    },
    {
      label: '操作',
      field: 'right',
      attribute: {
        fixed: 'right',
        width: '200px',
      },
      template: {
        options: [
          {
            icon: 'edit',
            type: 'primary',
            size: 'small',
            method: 'update',
          },
          {
            icon: 'delete',
            type: 'danger',
            size: 'small',
            method: 'remove',
          },
        ],
      },
    },
  ]
  /**
   * 添加对象
   */
  static addDTO: RoleMenuAddDTOType = {
    menuId: [],
    roleId: 0,
  }
  /**
   * 修改对象
   */
  static updateDTO: RoleMenuUpdateDTOType = {
    id: 0,
    menuId: '',
    roleId: '',
  }
  /**
   * 查询对象
   */
  static searchDTO: RoleMenuSearchDTOType = {
    page: {
      current: 1,
      size: 20,
    },
  }
}
